﻿using UnityEngine;
using System.Collections;
using System;

public class TimerController : BaseController {

    private static TimerController _inst;
    public static TimerController inst { get { return _inst; } }

    protected override void InitData()
    {
        base.InitData();
        _inst = this;
    }

    IEnumerator TimerFunc(float time, Action<System.Object> callback, System.Object param)
    {
        yield return new WaitForSeconds(time);
        callback(param);
    }

    public void CallAfter(float time, Action<System.Object> callback, System.Object param = null)
    {
        StartCoroutine(TimerFunc(time, callback, param));
    }
}
